package main

import "fmt"

func main() {
	//Range 遍历数组
	nums := []int{1, 2, 3, 4, 5}
	sum := 0
	for _, num := range nums {
		sum += num
	}
	fmt.Println(sum)
	//Range 遍历map
	kvs := map[string]string{"a": "chenxinchang", "b": "liuchen"}
	for k, v := range kvs {
		fmt.Printf("%s -> %s\n", k, v)
	}
	//Range 遍历字符串
	for i, c := range "golang" {
		fmt.Println(i, c)

	}

}
